﻿# CMakeList.txt: devices 的 CMake 项目，在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.16)

set (APP_QR "demo_qr")
set (APP_HS "demo_highspeed")
set (APP_A4 "demo_a4")
set (APP_ID "demo_id")


set(APP_NAME "devices")
project(${APP_NAME} VERSION 1.0 LANGUAGES CXX C)


if(NOT CMAKE_C_STANDARD)
    set(CMAKE_C_STANDARD 99)
endif (NOT CMAKE_C_STANDARD)

if(NOT CMAKE_CXX_STANDARD)
    set(CMAKE_CXX_STANDARD 11)
endif(NOT CMAKE_CXX_STANDARD)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g")

if (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -o0")
elseif (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Release"))
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -o3")
endif()

set(QR_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/qr/include")
set(HS_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/highspeed/include")
set(A4_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/a4print/include")
set(ID_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/idcard/include")

include_directories(
	"/usr/include"
	"QR_INCLUDE_DIR"
	"HS_INCLUDE_DIR"
	"A4_INCLUDE_DIR"
	"ID_INCLUDE_DIR"
)

add_subdirectory("./qr")
add_subdirectory("./highspeed")
add_subdirectory("./a4print")
add_subdirectory("./idcard")

# 将源代码添加到此项目的可执行文件。
add_executable (${APP_QR}
	"demo_qr.cc"
	"devices.h"
)

target_link_libraries(${APP_QR}
	PUBLIC
	qr
)

add_executable (${APP_HS}
	"demo_highspeed.cc"
	"devices.h"
)

target_link_options(${APP_HS}
	PUBLIC "-Wl,-rpath-link,${CMAKE_SOURCE_DIR}/highspeed/lib"
)

target_link_libraries(${APP_HS}
	PUBLIC
	highspeed
)

add_executable (${APP_A4}
	"demo_a4.cc"
	"devices.h"
	"a4print/a4print.h"
)

target_link_libraries(${APP_A4}
	PUBLIC
	a4print
)

add_executable (${APP_ID}
	"demo_idcard.cc"
	"devices.h"
)

target_link_libraries(${APP_ID}
	PUBLIC
	idcard
)

# TODO: 如有需要，请添加测试并安装目标。
